/**
 * Copyright (c) 2018-2099, Chill Zhuang 庄骞 (bladejava@qq.com).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springblade.modules.restaurant.service;

import cn.hutool.core.date.DateTime;
import com.baomidou.mybatisplus.core.metadata.IPage;
import jakarta.validation.Valid;
import org.springblade.core.mp.base.BaseService;
import org.springblade.modules.restaurant.entity.Task;
import org.springblade.modules.restaurant.entity.TaskRecord;
import org.springblade.modules.restaurant.vo.*;

import java.math.BigDecimal;
import java.util.List;

/**
 * 任务记录 服务类
 *
 * @author Blade
 * @since 2025-01-21
 */
public interface ITaskRecordService extends BaseService<TaskRecord> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param taskRecord
	 * @return
	 */
	IPage<TaskRecordVO> selectTaskRecordPage(IPage<TaskRecordVO> page, TaskRecordVO taskRecord);

	/**
	 * 获取区域月评分
	 *
	 * @param areaIds
	 * @param startTime
	 * @param endTime
	 * @return
	 */
	BigDecimal getAreaMonthScore(List<Long> areaIds, DateTime startTime, DateTime endTime);

	/**
	 * 新建任务并下发
	 *
	 * @param task
	 * @return
	 */
	boolean addTask(TaskRecordVO task);

	/**
	 * 任务下发
	 *
	 * @param task
	 * @param taskVO
	 * @return
	 */
	boolean assignTask(Task task, TaskRecordVO taskVO);

	/**
	 * 草稿保存
	 *
	 * @param taskVO
	 * @return
	 */
	boolean saveDraft(@Valid TaskDraftVO taskVO);

	/**
	 * 任务提交
	 *
	 * @param taskVO
	 * @return
	 */
	boolean submitTask(@Valid TaskSubmitVO taskVO);

	/**
	 * 任务检查
	 *
	 * @param taskVO
	 * @return
	 */
	boolean checkTask(@Valid TaskCheckVO taskVO);

	/**
	 * 任务驳回
	 *
	 * @param taskVO
	 * @return
	 */
	boolean rejectTask(@Valid TaskRejectVO taskVO);

	/**
	 * 待办任务统计
	 *
	 * @param userId
	 * @param role
	 * @return
	 */
	long waitTaskCount(Long userId, String role);

	/**
	 * 任务统计
	 *
	 * @param userId
	 * @param role
	 * @return
	 */
	long taskCount(Long userId, String role);

	/**
	 * 设置执行人
	 *
	 * @param task
	 * @return
	 */
	boolean setExecutor(@Valid TaskSetExecutorVO task);

	/**
	 * 评分
	 *
	 * @param taskVO
	 * @return
	 */
	boolean scoreTask(@Valid TaskScoreVO taskVO);
}
